package com.example.xm.adapter.HomeAdapter;

import android.content.Context;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.example.xm.R;
import com.example.xm.base.BaseAdapter;
import com.example.xm.bean.HomeBean.HomeYouHomeArticleBean;

import java.util.List;

import butterknife.BindView;

public class YouHomeArticleAdapter extends BaseAdapter {

    @BindView(R.id.iv_img)
    ImageView ivImg;
    @BindView(R.id.tv_title_article)
    TextView tvTitleArticle;
    @BindView(R.id.rl)
    RelativeLayout rl;
    @BindView(R.id.tv_titlearticle1)
    TextView tvTitlearticle1;
    @BindView(R.id.tv_name)
    TextView tvName;
    @BindView(R.id.tv_data_article)
    TextView tvDataArticle;

    public YouHomeArticleAdapter(Context context, List data) {
        super(context, data);
    }

    @Override
    protected int getLayout() {
        return R.layout.fragment_youhome_article_item;
    }

    @Override
    protected void bindData(BaseViewHolder viewHolder, Object o) {
        ImageView img = (ImageView) viewHolder.getViewById(R.id.iv_img);
        TextView title = (TextView) viewHolder.getViewById(R.id.tv_title_article);
        TextView tilte1 = (TextView) viewHolder.getViewById(R.id.tv_titlearticle1);
        TextView name = (TextView) viewHolder.getViewById(R.id.tv_name);
        TextView date = (TextView) viewHolder.getViewById(R.id.tv_data_article);
        HomeYouHomeArticleBean.DataBean.ArticlesBean bean = (HomeYouHomeArticleBean.DataBean.ArticlesBean) o;
        img.setAlpha(0.5f);
        Glide.with(context).load(bean.getCover()).into(img);
        title.setText(bean.getTitle());
        tilte1.setText(bean.getTitle());
        name.setText(bean.getNickName());
        date.setText(bean.getCreateTime());
    }
}
